﻿using Microsoft.Extensions.Logging;
using ZH.GPT.Domains.User.Response;
using ZH.GPT.Infrastructures.Entities;
using ZH.GPT.Infrastructures.Enum;
using ZH.GPT.Infrastructures.Repositories.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ZH.GPT.Services.Interface
{
    /// <summary>
    /// 用户Service
    /// </summary>
    public class UserService : IUserService
    {
        /// <summary>
        /// 用户仓储
        /// </summary>
        IUserRepository userRepository;

        /// <summary>
        /// 日志
        /// </summary>
        private readonly ILogger<UserService> logger;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="logger">日志</param>
        /// <param name="userRepository">用户仓储</param>
        public UserService(ILogger<UserService> logger, IUserRepository userRepository)
        {
            this.logger = logger;
            this.userRepository = userRepository;
        }

        /// <summary>
        /// 获取用户名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<UserPDTO> GetUserAsync(Guid id)
        {
            return await userRepository.GetUserAsync(id, DBOption.Slave);
        }

        /// <summary>
        /// 批量添加用户
        /// </summary>
        /// <returns></returns>
        public async Task<int> AddUserBatchTestAsync()
        {
            return await userRepository.AddUserBatchTestAsync();
        }
    }
}
